#include "position.h"

namespace IAlib
{
    Position::Position()
    {
        m_x = 0;
        m_y = 0;
        m_z = 0;
        m_workspace_id = "world";
    }

    QDomElement Position::toXML(QDomDocument &doc)
    {
        QDomElement ele = doc.createElement("position");
        ele.setAttribute("x", QString::number(m_x));
        ele.setAttribute("y", QString::number(m_y));
        ele.setAttribute("z", QString::number(m_z));
        ele.setAttribute("workspaceID", m_workspace_id);
        return ele;
    }

    void Position::fromXML(QDomElement ele)
    {
        m_x = ele.attribute("x","").toFloat();
        m_y = ele.attribute("y","").toFloat();
        m_z = ele.attribute("z","").toFloat();
        setWorkSpaceId(ele.attribute("workspaceID",""));
    }
}
